package com.logic;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import com.persistence.Address;

public class AddressLogic {
	
	EntityManager em;
	EntityManagerFactory emf;
	
	private EntityManager inicializarEntityManager(){
		emf = Persistence.createEntityManagerFactory("ProyectoToby");
		return emf.createEntityManager();
	}
	
	public List<Address> getAll(){
		em = inicializarEntityManager();
		List<Address> direcciones= (List<Address>) em.createNamedQuery("selectallAddress").getResultList();
		return direcciones;
	}

}
